<!--
 * @Author: yaojian66 1327629137@qq.com
 * @Date: 2022-06-28 20:14:37
 * @LastEditors: yaojian66 1327629137@qq.com
 * @LastEditTime: 2022-06-29 10:07:04
 * @FilePath: \geyao\第八十九题 生成页码.html
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>生成页码</title>
</head>

<body>
  <!-- 请补全JavaScript代码，要求根据参数动态生成"li"标签页码并插入"ul"标签下。要求如下：
1. "allItem"为总数据项个数，"pageItem"为每页的数据项个数
2. "li"标签内容为当前页码数，页码从1开始
示例1
输入：

_createPage(13,2)

输出：

"li"长度为7，"li"内容依次为"1","2","3","4","5","6","7" -->

  <ul id="ul">

  </ul>
  <script type="text/javascript">
    const _createPage = (allItem, pageItem) => {
      // 补全代码
      const _createPage = (allItem, pageItem) => {
        let ul = document.querySelector('#ul')
        let pageNumber = Math.ceil(allItem / pageItem)
        for (let i = 1; i <= pageNumber; i++) {
          let li = document.createElement('li')
          li.innerText = i
          ul.appendChild(li)
        }
      }
    }
  </script>

</body>

</html>